home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / csim.doc < prev    next >
Text File  |  1995-03-31  |  26KB  |  589 lines

  1. Csim 2.5, Circuit Simulator 
  2. SHORT DESCRIPTION AND MANUAL 10/25/91 (c) Per Stenius 
  3.  
  4. RELEASE NOTE 
  5.  
  6. This version differs from the previous (2.3) in the following: 
  7. - Lossless transmission line for AC analysis at a single freq. point. (T) 
  8. - The functions CV(node) and CI(branch) that fetch the voltage/current of 
  9.   given node/branch in the previous solution point. CV = ControlVoltage, 
  10.   can be used in other sources to define any functional dependency of a 
  11.   voltage/current in the circuit. Note that there is a delay of 'tstep' 
  12.   when using these functions. 
  13. - The program 'iterdc' for iterative dc solving to be used with nonlinear 
  14.   components. 
  15. - Additional examples of circuits in manual. 
  16. - New sample circuit. 
  17.  
  18. INTRODUCTION 
  19.  
  20. This text describes a simple circuit simulator called Csim for the HP48. It 
  21. makes DC, AC and transient simulations and supplies the user with all matrices 
  22. used. The method used is modified nodal analysis, and thus elements such as an 
  23. inductor or ideal voltage source require that a current branch is also 
  24. specified together with the nodes. As soon as a setup is done, single analyses 
  25. can be made with the 'dc', 'ac' or 'tran' subprograms. All subprograms return 
  26. the result as a vector, whereas Csim provides the user with a plot in transient 
  27. and AC analysis. Note that for Csim to work correctly, the 'node' variable 
  28. should be defined (either a node or branch number) when plotting a result. Note 
  29. also that the RES variable (in PLOTR) should be 0. Finally, if SYM (in MODES) 
  30. is not set Csim does not work correctly. 
  31.  
  32. For a demo on how Csim works do the following: 
  33. - download the code (creates the directory CSIM in the current directory) 
  34. - enter the directory CSIM and press CST 
  35. - press Csim: 
  36.   for: Setup? Y  press: <enter> 
  37.   for: Analysis? (D,A,T) press: T <enter> 
  38.   for: Sweep range? 
  39.        :tstart:0 
  40.        :tstep:0 
  41.        :tstop:1          press: <backspc> 5 <enter> i.e. :tstop:5 
  42.   after which a time-domain plot is drawn (if you have something that you 
  43.   previously have plotted, press CLRSC before doing this). 
  44.   Press <ON> to exit the graph environment. 
  45.   Now, press CST and 3 <left-shft> node <enter> and redo the above. 
  46.   Finally, press CST <next> CIR CIR-> to see the circuit description. 
  47.  
  48. Here is an explanation on the CST menu: 
  49.  
  50. Csim - the simulator program. Runs setup (if requested) and a single 
  51.         analysis. For ac, a single run directly from CST provides a fast 
  52.         solution in one freq-point. When choosing T for transient analysis 
  53.         either tstep (time resolution) or tstop should be given. If both 
  54.         are given tstep is used and tstop ignored. 
  55.  
  56. View  - the StackView application, for easy check on components. Use ATTN 
  57.         (ON) to exit. You can also use the Interactive Stack the HP48 
  58.         provides (see manual p.70). 
  59.  
  60. node  - the node or branch the value of which is wanted as a solution. Used 
  61.         to GET the right value from the solution vector. 
  62.  
  63. ymin, ymax 
  64.       - define the picture y-axis (ac or tran analysis) 
  65.  
  66. CLRSC - Clears the screen (simply the ERASE command) 
  67.  
  68. outp  - a program that takes a vector from the stack and returns one value. 
  69.         it can be used to plot a result that is a function of the values in 
  70.         the solution vector. To be edited by the user. 
  71.         (default << node GET >> ) 
  72.  
  73. CIR-> - takes a list of lists, such as the one used to store circuit 
  74.         descriptions (see also CIR, ->CIR) and puts the lists in it to 
  75.         the stack (inverse to ->CIR). Usage: Press a variable containing 
  76.         a circuit description (e.g. CIR) and press CIR->. 
  77.  
  78. ->CIR - takes the circuit description used by Csim and puts it to a list, 
  79.         that can be stored in a variable. 
  80.  
  81. CIR   - when 'Setup' is run, the stack containing the circuit is stored in 
  82.         this variable as a list. To use again, recall CIR and run 'CIR->'  
  83.         (see above). Contains a sample circuit as default. Any circuit 
  84.         description can be stored in a variable as a list of components 
  85.         (which also are lists). 
  86.  
  87. dc    - single DC analysis.  Requires that setup is done (the matrices are 
  88.         ready). Takes no argument from stack and returns a solution vector. 
  89.  
  90. ac    - single AC analysis. Requires that setup is done (the matrices are 
  91.         ready) and that 'w' is specified (rads/s angular freq). Takes no 
  92.         argument from stack and returns a solution vector. Note: Complex 
  93.         values! When A is chosen in Csim, the actual program stored by STEQ 
  94.         is 'acplot', which executes 'ac' and then 'outp'. The program 'outp' 
  95.         should take a vector from stack and return a single number. E.g. 
  96.         << node GET ABS >> would return the absolute value of a node voltage 
  97.         (or branch current) that is to be plotted. 
  98.  
  99. tran  - single transient analysis. Takes one time step and returns a solution 
  100.         vector. The method used is trapezoidal rule. When T is chosen in 
  101.         Csim, the actual program stored by STEQ is 'tranBE' (or 'tranTR'). 
  102.         These return the result vector and call 'outp'. The program 'outp' 
  103.         should take a vector from stack and return a single number. E.g. 
  104.         << node GET >> would return the value of a node voltage (or branch 
  105.         current) that is to be be plotted. 
  106.  
  107. Setup - setup routine for the simulator. Creates and loads the matrices 
  108.         needed and stores the stack as a list into CIR. Takes the circuit 
  109.         description from the stack as an argument (only component declarations 
  110.         are allowed on stack). Setup must be done once before analyzing, 
  111.         however, after that the matrices are ready to be used multiple times. 
  112.         This should be remembered e.g. when calculating a DC solution and 
  113.         thereafter starting a transient analysis from the obtained results. 
  114.         In this case running Setup a second time would zero the result vector. 
  115.         Setup also clears flag -3 (i.e. enables SYM), sets flag -17 and clears 
  116.         flag -18 (i.e. sets radians mode). 
  117.  
  118. w     - angular frequency (2*pi*f) rad/s. 
  119.  
  120. G     - conductance matrix. Contains all real valued entries, i.e. those 
  121.         caused by elements the values of which do not have an s or jw 
  122.         factor. 
  123.  
  124. C     - s-matrix. Contains all elements that have an s or jw factor. 
  125.  
  126. Cc    - constant valued complex matrix. Can be used in AC analysis only, 
  127.         at a single value of 'w' (angular frequency). Contains entries from 
  128.         Z, Y, z, y (See Section on syntax). 
  129.  
  130. W     - numerical values of the sources as a vector. This vector is updated 
  131.         in every analysis point. 
  132.  
  133. Wlist - the functions representing each source as a list, from which the 
  134.         numerical values for 'W' are obtained. 
  135.  
  136. Euler - specifies the method used in the tran analysis. If Euler = 1 then 
  137.         backward Euler ('tranBE') is used (faster but more inaccurate), if 
  138.         Euler = 0 then the trapezoidal rule is used, which is rather accurate 
  139.         but slower ('tranTR' and 'tran'). 
  140.  
  141. iterdc 
  142.       - if CV() or CI() are used in DC analysis, iterative solution is 
  143.         required in order to obtain the correct solution. 'iterdc' can 
  144.         be used for this after setup has been done. Note that very few 
  145.         nonlinear circuits can actually be solved by iteration only. 
  146.         Usually some linearization method must also be used, e.g. the 
  147.         Newton-Raphson algorithm. 
  148.  
  149. THE SYNTAX USED TO DESCRIBE A CIRCUIT 
  150.  
  151. The syntax by which the components are entered is (NOTE! Each circuit needs a 
  152. ground node and its number is always 0 (zero)): 
  153.   
  154. {R node1 node2 numval branch} - resistance [ohm] 
  155.  
  156. {G node1 node2 numval}        - conductance [mho] 
  157.  
  158. {C node1 node2 numval}        - capacitance [F] 
  159.  
  160. {L node1 node2 numval branch} - inductance [H] 
  161.  
  162. {Y node1 node2 complexnumval} - admittance with a constant complex value 
  163.                                 (re,im) 
  164.  
  165. {Z node1 node2 complexnumval} - impedance with a constant complex value 
  166.                                 (re,im) 
  167.  
  168. {J node1 node2 funcval}       - indep. current source 
  169.  
  170. {E node1 node2 funcval branch} 
  171.                               - indep. voltage source   
  172.  
  173. {S node1 node2 branch}        - short circuit (the current is fetched by 
  174.                                 branch GET). Can be used to define a current 
  175.                                 branch for dependent sources. 
  176.  
  177. {O in+ in- out+ out- outbranch} 
  178.                               - ideal opamp (out- should be ground, 
  179.                                 outbranch returns the output current) 
  180.  
  181. {M l1node1 l1node2 l2node1 l2node2 l1val l2val mval l1branch l2branch} 
  182.                               - transformer i.e. two inductors (l1, l2) with 
  183.                                 mutual inductance (mval). The values required 
  184.                                 are the four nodes, the value of l1, l2, mval 
  185.                                 [H] and the branches of l1 and l2. The dots  
  186.                                 for m are at l1node1 and l2node1. 
  187.  
  188. {m l1branch l2branch mval}    - mutual inductance of mval [H]. As M, but can 
  189.                                 be used to define e.g. three inductances that 
  190.                                 all have mutual inductances. To do this, define 
  191.                                 the 3 L:s and then 3 m:s between them. Note 
  192.                                 that m takes the branches of the L:s. Make sure 
  193.                                 you specify the inductors the right way (the 
  194.                                 branch of L runs from n1 to n2). Note also that 
  195.                                 m is not a component, it merely states a 
  196.                                 dependency between two L:s that should be 
  197.                                 defined separately. No checking is done that 
  198.                                 l1branch and l2branch actually belong to L:s. 
  199.  
  200. {T node1 node2 node3 node4 llval Zoval} 
  201.                               - lossless transmission line (to be used in AC 
  202.                                 analysis only) of length ll (in wavelengths) 
  203.                                 and with the characteristic impedance Zo. Note 
  204.                                 that nodes 2 and 4 must have the same value 
  205.                                 (equivalent pi-circuit used). 
  206.  
  207. {g node1 node2 node3 node4 numval} 
  208.                               - voltage-controlled current source i.e. 
  209.                                 transconductance. The source current is 
  210.                                 from node3 to node4 and the controlling 
  211.                                 voltage from node1 to node2. 
  212.  
  213. {r node1 node2 node3 node4 numval branch1 branch2} 
  214.                               - current-controlled voltage source. Defines a 
  215.                                 short circuit between node1 and node2 and a 
  216.                                 controlled voltage source between node3 and 
  217.                                 node4 (node3 being the positive node). The 
  218.                                 controlling current runs through branch1 and 
  219.                                 the current of the source is fetched from 
  220.                                 branch2. Branch1 must not be a previously 
  221.                                 defined branch. 
  222.  
  223. {p node3 node4 numval branch1 branch2} 
  224.                               - same as r but does not define a short circuit 
  225.                                 between node1 and node2. Instead branch1 must 
  226.                                 be a predefined branch (e.g. that of a 
  227.                                 resistor or inductor).  
  228.   
  229. {a node1 node2 node3 node4 numval branch} 
  230.                               - current-controlled current source. Defines 
  231.                                 a short circuit between node1 and node2 
  232.                                 and a controlled current source the current of 
  233.                                 which runs from node3 to node4. The controlling 
  234.                                 current runs through branch which must not be 
  235.                                 previously defined. 
  236.                                  
  237. {b node3 node4 numval branch} - same as a but does not define a short circuit 
  238.                                 between node1 and node2. Instead branch must 
  239.                                 be a predefined branch (e.g. that of a 
  240.                                 resistor or inductor). Compare with p. 
  241.  
  242. {u node1 node2 node3 node4 numval branch} 
  243.                               - voltage-controlled voltage source. The current 
  244.                                 through the source is fetched from branch. 
  245.  
  246. {y node1p1 node2p1 node1p2 node2p2 y11 y12 y21 y22} 
  247.                               - a two-port with y-parameters that are constant 
  248.                                 complex values (re,im) 
  249.  
  250. {z node1p1 node2p1 node1p2 node2p2 z11 z12 z21 z22} 
  251.                               - a two-port with z-parameters that are constant 
  252.                                 complex values (re,im) 
  253. FUNCTIONS 
  254.  
  255. CV(node)                      - returns previously calculated value of the 
  256.                                 voltage of node. In code << X node GET >> 
  257.  
  258. CI(branch)                    - returns previously calculated value of the 
  259.                                 current of branch. In code << X branch GET >>, 
  260.                                 the same as CV(). 
  261.  
  262. In the above, nodes and branches are integer numbers. The ground node is 
  263. represented by 0. All nodes and branches should have a unique number and they 
  264. should be given in order e.g. nodes 0,1,2,3 and branches 4,5,6. These numbers 
  265. refer DIRECTLY to the position in the matrices/vectors. Thus the 4'th element 
  266. in the result vector would be the current through branch 4 and the first 
  267. element is the voltage of node 1. To help remembering the syntax, you could 
  268. e.g. have a variable y with the following contents: 
  269.  
  270. {y n1p1 n2p1 n1p2 n2p2 y11 y12 y21 y22} 
  271.  
  272. The following components form equivalent circuits: 
  273.  
  274. {S 1 2 5} 
  275. {p 3 4 100 5 6} is the same as 
  276.  
  277. {r 1 2 3 4 100 5 6}, 
  278.  
  279. {S 1 2 5} 
  280. {b 3 4 100 5} is the same as 
  281.  
  282. {a 1 2 3 4 100 5}, 
  283.  
  284. {L 1 2 0.1 5} 
  285. {L 3 4 0.2 6} 
  286. {m 5 6 0.05} is the same as 
  287.  
  288. {M 1 2 3 4 0.1 0.2 0.05 5 6}. 
  289.  
  290. Finally, an example of usage for transient analysis: 
  291. (This is how your stack should look) 
  292.  
  293. {E 1 0 '10*SIN(10*t)' 4} 
  294. {C 1 2 0.01} 
  295. {L 2 3 1 5} 
  296. {R 3 0 10 6} 
  297.  
  298. This defines a RLC-circuit with nodes 1,2,3 (and ground) and current branches 
  299. 4,5,6. The current through branch 4 is equal to the current through the ideal 
  300. voltage source E, the current through branch 5 equals the current through the 
  301. inductor L, and the current through branch 6 equals the current through the 
  302. resistor R. The values of the components (which ALWAYS must be numerical) are 
  303. 10 ohms, 1 henry and 0.01 farads. The voltage source has a time-dependent value 
  304. (used in transient analysis). If 'node' is set to 3 the voltage over the 
  305. resistor R is plotted in transient analysis. On the other hand, 'outp' could be 
  306. written as << DUP 1 GET SWAP 2 GET - >> to return the voltage between nodes 1 
  307. and 2 as a result. Note that sources (E,J) may have functional values (should 
  308. be suitable for the analysis requested! Time dependency for transient analysis 
  309. and 'w' dependency (angular freq) for AC). When running Csim, the stack may 
  310. ONLY contain component declarations! 
  311.  
  312. Press CST and then View. Now press ATTN (low-left corner, i.e. ON). 
  313. Press Csim, press Enter on "Setup? Y", press D (or T), Enter on analysis.   
  314.  
  315. An example for AC analysis (using A in Csim): 
  316.  
  317. {E 2 0 1 3} 
  318. {G 2 1 1} 
  319. {C 1 0 1} 
  320.  
  321. Set 'node' equal to 1 and write 'outp' equal to << node GET ABS >>. Select 
  322. A on analysis and choose wstart 0 and wstop 10 (ymin = 0, ymax = 1). 
  323.  
  324. Another example for AC analysis (using 'w' = 1 and 'ac'): 
  325.  
  326. {J 0 1 10} 
  327. {G 3 0 1} 
  328. {G 2 0 1} 
  329. {Z 1 0 (0,-1)} 
  330. {M 3 1 2 1 2 1 0.5 4 5} 
  331.  
  332. Setup 
  333. 1 left-shft w ac 
  334.  
  335. The currents through the transformer are the 4'th and 5'th elements in the 
  336. result vector. Here's an example involving a transistor for which we have the 
  337. y-parameters y11 = 0.001, y12 = -j0.0001, y21 = 0.1 and y22 = 0.0001. Its base 
  338. is at node 1, emitter at gnd (node 0) and collector at node 2. 
  339.  
  340. {J 0 1 1} 
  341. {Z 1 0 1E3}       @ resistance of 1 kohms 
  342. {Z 2 0 1E3} 
  343. {Z 1 2 (0,-1000)} @ capacitance of -j1000 ohms 
  344. {y 1 0 2 0 1E-3 (0,-1E-4) 0.1 1E-4} 
  345.  
  346. Setup 
  347. ac 2 GET ABS (returns |Uo/Jin| = 884.035 V/A) 
  348.  
  349. For the use of the lossless transmission line we have the following example 
  350. (analysis can be made at a single frequency point only, at which ll is valid): 
  351.  
  352. {J 0 1 1} 
  353. {Z 2 0 (75,-69)} 
  354. {T 1 0 2 0 0.583 50} 
  355.  
  356. Setup ac 1 GET 
  357.  
  358. returns (25.2092, -34.5800) which is the input impedance (J = 1) of a lossless 
  359. transmission line of the length 0.583 wavelengths (at some frequency) and with 
  360. the characteristic impedance of 50, terminated with a load of (75,-69) ohms. 
  361.  
  362. DC analysis: 
  363.  
  364. {J 0 1 1} 
  365. {R 1 0 1E3 3} 
  366. {p 2 0 10 3 4} 
  367.  
  368. The voltage of node 2 (the 2'nd element in the result vector) should be 10V. 
  369. The current through the controlled voltage source should be 0A (the 4'th 
  370. element in the result vector). 
  371.  
  372. For iterative DC solving of  circuits, consider these two examples: 
  373.  
  374. {E 1 0 1 3} 
  375. {G 1 0 1} 
  376. {G 1 2 1} 
  377. {J 0 2 'SQ(CV(1))'} 
  378.  
  379. and 
  380.  
  381. {J 0 1 1} 
  382. {G 1 0 1} 
  383. {G 1 2 1} 
  384. {E 2 0 'SQ(CV(1))' 3} 
  385.  
  386. Setup iterdc 
  387.  
  388. The first circuit converges after only two iterations, but the second one 
  389. requires several hundred to reach the exact solution ([[1] [1] [0]] in the 
  390. second case). Good initial guesses may help, and also the use of e.g. the 
  391. Newton-Raphson algorithm (see Vlach-Singhal; Computer Methods for Circuit 
  392. Analysis and Design). Note that 'iterdc' should actually also be used at every 
  393. time step in transient analysis to avoid the delay when using CV() and CI(). 
  394.  
  395. A simple small signal model for a transistor (B-1 C-2 E-3): 
  396.  
  397. {R 1 3 1E3 4} 
  398. {G 2 3 0.0001} 
  399. {b 2 3 100 4} 
  400.  
  401. A voltage source used as an digital inverter; if the voltage of node 2 is 
  402. higher than 2.5 volts, then the voltage of node 3 is 0 volts, otherwise 5 volts 
  403. (note that there is a delay of one 'tstep'). 
  404.  
  405. {E 3 0 'IFTE(CV(2)>2.5,0,5)' 4} 
  406.  
  407. Including nonlinear components as such would make solving the matrix equation 
  408. system a tedious process. It would also make the analysis MUCH slower. However, 
  409. it could be done. 
  410.  
  411. ERROR MESSAGES 
  412.  
  413. These are the only error messages in this program. Note that there are not many 
  414. error checking routines provided, so the user should be careful when entering 
  415. the circuit description. For any strange behaviour or false results, please 
  416. email me directly and explain what occurred. 
  417.  
  418. SYNTAX ERROR - an error occurred in 'Setup' while Csim was loading the 
  419.                matrices. Check the circuit description and the component that 
  420.                is first on stack. See also section on syntax. 
  421.  
  422. NEGATIVE NODE NO. - a negative number was given as a node number. Check the 
  423.                the first component on stack. 
  424.  
  425. BOTH NODES SAME - a component was specified having two nodes that were the 
  426.                same value. To override this, use a short-circuit (S) between 
  427.                these nodes. 
  428.  
  429. BOTH NODES GND - both nodes of a component were specified to be GND (i.e. 
  430.                their node numbers were zero). 
  431.  
  432. ZERO VALUE OR BRANCH - a component with a value of zero was given or its 
  433.                branch number was zero (which is reserved for the ground node). 
  434.  
  435. n2 MUST EQUAL n4 IN T - you have entered a transmission line in the circuit 
  436.                with nodes 2 and 4 not equal. This is not allowed since the 
  437.                equivalent pi-circuit to the transmission line is actually used. 
  438.  
  439. A good way to avoid errors is to proceed systematically, e.g. in the following 
  440. way: 
  441.  
  442. 1) Choose one reference node to be ground (GND) and set its node number to 0. 
  443.  
  444. 2) Assign the rest of the nodes a number each, in numerical order (1,2,3,...) 
  445.  
  446. 3) Find all the components that require a branch and assign each required 
  447.    branch a number starting from the highest node number plus one. 
  448.  
  449. !) The node and the branch numbers should follow eachother in numerical order, 
  450.    with no 'gaps' in between (e.g. 0,1,2 are nodes and 3,4 are branches). 
  451.  
  452. 4) Enter the circuit description component by component. Note that the stack 
  453.    should only contain component descriptions! Check your stack with 'View'. 
  454.  
  455. 5) Decide what results you need and edit 'outp' if necessary. Also, set 'node' 
  456.    to the correct value. 
  457.  
  458. 6) Run 'Setup' once and start analyzing! Remember to run 'Setup' whenever you 
  459.    change your circuit or want to start from zero. Sometimes all you need to 
  460.    do is to edit your X vector.  
  461.  
  462. FREQUENTLY ASKED QUESTIONS 
  463.  
  464. Some people have had trouble with the branch currents (the direction...) so 
  465. here's more on that: 
  466.  
  467. In all components (J,E,L etc.) the current is defined to be FROM the first node 
  468. TO the second node. Thus no matter which way you put your source (E) The value 
  469. of the branch current remains the same (i.e. in the direction of the U of the 
  470. source) with respective to the source. In the sample RLC circuit, when the 
  471. first node of E and L is the same, the currents should be the opposite. When 
  472. the second node of E is the first node of L, the currents are the same. 
  473.  
  474. For E the situation looks like this: 
  475.  
  476.            --- U=E --> 
  477.  
  478.  node1 +  o->-( E )---o - node2 
  479.  
  480.             I 
  481.  
  482. for L: 
  483.  
  484.            --- U1,2 -> 
  485.  
  486.  node1    o->- Ind ---o   node2 
  487.  
  488.             I 
  489.  
  490. for J: 
  491.  
  492.  node1    o->-( J )---o   node2 
  493.  
  494.             I=J 
  495.  
  496. for S:     
  497.  
  498.            --- U=0 --> 
  499.  
  500.  node1    o----->-----o   node2 
  501.  
  502.                 I 
  503.  
  504. This could be defined the other way around too, but in this case it isn't. 
  505.  
  506. For two-ports, the node numbers are defined as 
  507.  
  508.                 _________ 
  509.  node1    o->--|         |--<-o node3 
  510.                |         |              
  511.                |         | 
  512.                |         |   
  513.                |         | 
  514.  node2    o----|_________|----o node4 
  515.  
  516. Note that the direction of the currents is always towards the two-port. This 
  517. should be remembered when defining e.g. ideal opamps, controlled sources and 
  518. two-ports with y- or z-parameter representation. 
  519.  
  520. >I can't get the transient analysis to work properly unless I do 
  521. >an entire setup first. If I do a transient plot, and then repeat it, I 
  522. >get different results, unless I run setup. 
  523.  
  524. What happens is that unless you run setup, the transient analysis continues 
  525. from where it stopped (however, this time from the beginning of the screen). 
  526. Thus the new beginning should match with the previous end. As you might have 
  527. noticed, the transient analysis should always start from time=0. This is due to 
  528. the fact that solving this problem is an iterative process. 
  529.  
  530. >It would be nice to be able to specify initial values for capacitors and 
  531. >inductors. 
  532.  
  533. This can be done. The X vector contains the starting values, and is zeroed at 
  534. setup. However, nothing stops you from running a dc-analysis and then running a 
  535. tran analysis without a setup in between, thereby giving the results from the 
  536. dc-analysis as beginning values for the tran analysis. The X vector can also be 
  537. manually edited. To do this, run setup, then press enter for analysis?, which 
  538. stops the program. Edit the X, and run tran analysis without setup. The 
  539. execution of setup can be avoided by answering something else than 'Y' at 
  540. 'Setup?'. 
  541.  
  542. >I'm interested in any references you used, for algorithms for circuit solving, 
  543. >this is something I've never really looked into before. 
  544.  
  545. A good place to start is to look at a book called 
  546.  
  547. Computer Methods for Circuit Analysis and Design 
  548.  
  549. by Jiri Vlach and Kilshore Singhal (Van Nostrand Reinhold Company 1983, ISBN 
  550. 0-442-28108-0). Check out chapter 4 and 9. For transient analysis, (which is 
  551. normally done by Laplace tranforms when working manually) the trapezoidal rule 
  552. is pretty powerful. Also, for all the theory needed for Csim, I have written a 
  553. report called 
  554.  
  555. A Tutorial on Developing a Simple Circuit Simulating Program 
  556.  
  557. which I can email (ps-file format) to anybody interested upon request. It is 
  558. about 25 pages + 30 pages including this manual and the commented source code 
  559. for Csim. 
  560.  
  561. FINAL REMARK 
  562.  
  563. Csim takes 10208.5 bytes when loaded, and its checksum is #45412d. 
  564.  
  565. This simulator is not necessarily completely bug-free, so please report to me 
  566. for any strange behaviour. Note also that the transient analysis methods are 
  567. not necessarily stable for all values of time steps. Try another time range or 
  568. time step if this happens. If you get the system error 
  569.  
  570.    INV Error: 
  571.    Infinite Result 
  572.  
  573. in any analysis mode, this usually indicates that the component matrix cannot 
  574. be inverted. This error can sometimes be avoided by assigning the nodes the 
  575. values 0...n and the branches the values n+1...m. If this does not help, please 
  576. send me the circuit description you used. 
  577.  
  578. I am happy to provide any further information on this program. Please send also 
  579. some comments on its appearance, suggestions on improvement etc. Note that very 
  580. little syntax checking is done (e.g. no node or branch number checks!). I hope 
  581. this short manual is sufficient, if not please ask me directly via email. 
  582.  
  583. copyright Per Stenius, Helsinki University of Technology. 
  584.           email perre@aplac.hut.fi or pstenius@otax.tky.hut.fi 
  585.  
  586.